<?php
//error_reporting(0);
$isadmin=1;
include_once '../comm/config.php';
include_once '../comm/Taoapi.php';
include_once '../comm/msgset.php';
include_once 'check.php';
$sj= date("Ymd");
$geturlkey=trim(GETKEY);
if($_POST['daoru']!=NULL){
	$frmdate=$_POST['frmdate']; $enddate=$_POST['enddate']; $fnum=$snum=0;
	for($sj1=$frmdate;$sj1<=$enddate;){
		include '../comm/GetReport.php';
		$sj1=date("Ymd", strtotime ("$sj1 +1 day"));
	}
	if($err_msg){
		$msg= "Appkey 调用超频，请稍后再试。 ".$sub_msg;
	}else{
		$msg= "成功获取 ".$snum." 条交易记录！<br>本次获取到的数据中，数据库中 ".$fnum." 条交易记录已经存在，获取过程忽略！<br>";
	}
	$sj= date("Ymd");
	admin_log('获取淘宝订单');
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link rel="stylesheet" type="text/css" href="../js/calendar/calendar-blue.css"/>
<script type="text/javascript" src="../js/calendar/calendar.js"></script>
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FF3300}
.STYLE2 {color: #009900}
-->
</style>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" align="left" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="images/arrow.gif" width="16" height="22" align="absmiddle" /> 获取交易记录</strong></td>
              </tr>
            <tr>
              <td valign="top"><form method="post" name="form1" action="daoru.php">
<br />
<table width="589" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="40" colspan="2" class="bigtext"><span class="STYLE2">提示：请选择获取交易的时间段。时间只能选择最近3个月内。<br />
      已经获取过的交易不会覆盖原有的数据，获取过程将自动忽略。<br />
      时间必须为8位，并且开始时间小于结束时间，否则将无法获取成功！<br />
      获取前请</span><a href="doclear.php" class="link3">先清空下缓存</a></td>
    </tr>
  <tr>
    <td width="121" height="40" class="bigtext">获取的时间范围：</td>
    <td width="468" height="40" class="bigtext">
      <input name="frmdate" type="text" id="sday" size="10" maxlength="8" value="<?php echo $sj ?>" />
     到  
     <input name="enddate" type="text" id="eday" size="10" maxlength="8" value="<?php echo $sj ?>" />    </td>
  </tr>
  <tr>
    <td height="40">&nbsp;</td>
    <td height="40"><input type="submit" name="daoru" value="获取交易记录" size="17"></td>
  </tr>
  <script language="javascript" type="text/javascript">
					 date = new Date();
					Calendar.setup({
						inputField     :    "sday",
						ifFormat       :    "%Y%m%d"
					});
					Calendar.setup({
						inputField     :    "eday",
						ifFormat       :    "%Y%m%d"
					});
				 </script>
  <tr>
    <td height="31" colspan="2" class="large-green"><?php echo $msg;?></td>
    </tr>
  <?php if(CHKEY==1){?>
  <tr>
    <td height="22" colspan="2" class="large-green"><span class="bigtext"><a href="http://container.open.taobao.com/container?appkey=<?php if($geturlkey==""){echo MYAPPKEY;}else{echo $geturlkey;}?>" class="link3" target="_blank"><img src="../images/ico-darrow.png" width="10" height="11" border="0" /> 如果你的应用是在2011年10月25日后申请或已转换，请先点这里先获取授权再获取记录</a></span></td>
  </tr>
  <?php }?>
  <tr>
    <td height="38" colspan="2" class="large-green"><span class="bigtext"><a href="daoru2.php" class="link3"><img src="../images/ico-darrow.png" width="10" height="11" border="0" /> 如果您无法成功获取数据，点击这里试试手动导入数据！</a></span></td>
  </tr>
</table>

</form>

</td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>